/*
 * HttpGetter.h
 *
 *  Created on: 2010-4-29
 *      Author: Yupeng
 */

#ifndef HTTPGETTER_H_
#define HTTPGETTER_H_

#include <http.h>
#include <f32file.h>
#include <es_sock.h>
#include <http\mhttpauthenticationcallback.h>

class CHttpGetter : public CBase, 
					 public MHTTPTransactionCallback
	{
public:
	static CHttpGetter * NewL(const TDesC& aUrl);
	~CHttpGetter();

public:
	// from MHTTPTransactionCallback
	void MHFRunL( RHTTPTransaction aTransaction, const THTTPEvent &aEvent );
	TInt MHFRunError( TInt aError, RHTTPTransaction aTransaction,
			const THTTPEvent &aEvent );
	
public:
	void StartGetL();

private:
	void ConstructL(const TDesC& aUrl);
	CHttpGetter();
	
private:
	TBuf8<512> iUri;

	RHTTPSession iHttp;
	RHTTPTransaction iTransaction;
	
	RFs iFs;
	RFile iFile;

	const TDesC* iFileName;
	TInt iPos;
	};
					

#endif /* HTTPGETTER_H_ */
